package com.sms.plateform.kernel.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sms.plateform.kernel.service.impl.BaseServiceImpl;
import com.sms.plateform.kernel.dao.IMenuInfoDao;
import com.sms.plateform.kernel.entity.MenuInfo;
import com.sms.plateform.kernel.entity.UserInfo;
import com.sms.plateform.kernel.entity.UserRole;
import com.sms.plateform.kernel.service.IMenuInfoService;

public class MenuInfoServiceImpl extends BaseServiceImpl<MenuInfo,IMenuInfoDao> implements IMenuInfoService {

	public List<MenuInfo> listMenuRoleInfoByRidAndParentCode(String rid,String parentcode) {
		// TODO Auto-generated method stub
		Map<String, Object> param=new HashMap<String, Object>();
		param.put("rid", rid);
		param.put("parentcode", parentcode);
		return this.getBaseDao().listMenuRoleInfoByRidAndParentCode(param);
	}

	public Map<String, Object> getTopMenu(UserRole userRole) {
		Map<String, Object> map = new HashMap<String, Object>();
		Map<String, Object> param = new HashMap<String, Object>();
		if(null == userRole){
			map.put("status", "100");  //无角色
			return map;
		}
		Integer role = userRole.getRid();
		if(null!=role){
			param.put("role", role);
			List<Map<String, Object>> topMenu = this.getBaseDao().getTopMenu(param);
			map.put("status", "999");  //正确
			map.put("list", topMenu);
		}
		return map;
	}
	
}
